const fs = require('fs');
const MiniProgram = require('../lib/mini-program');

const miniProgramApi = new MiniProgram({
    appId: 'wxdb5e522588334ebb',
    appSecret: '98445ef4fb071e8daf970f0fcb667ebb',
});


(async () => {
    try {
        // const res = await miniProgramApi.code2Session({
        //     js_code: '043UrJBD0suoYk2DDgDD0qPIBD0UrJBZ',
        // })

        // await miniProgramApi.getAccessToken().then(accessAoken => {
        //     console.log('accessAoken', accessAoken);
        // })

        await miniProgramApi.getUnlimited({
            scene: '1',
        }).then(v => {

            fs.writeFile('1.png', v, (err) => {
                if (err) throw err;
            })
        })

    } catch (e) {
        console.error('出错', e);
    }
})()